<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
            }
            div{
                width: 125px;
                margin-left: auto;
                margin-right: auto;
            }
            button{
                width: 50px;
                margin-right: 10px;
            }
            h1{
                text-align: center;
                margin-top: 20px;
                font-size: 200px;
            }
        </style>
    </head>
    <body>
        <div>
            <button id="ks">开始</button>
            <button id="js">结束</button>
        </div>
        <h1 id="cj">开始抽奖</h1>
        <script>
            var ks=document.getElementById('ks');
            var js=document.getElementById('js');
            var cj=document.getElementById('cj');
            var s;
            var d=['第一','第二','第三','第四'];
            console.log(d[0]);
            console.log(d.length);
            ks.onclick=function(){
                clearInterval(s);
                s=setInterval(function(){
                    var n=parseInt(Math.random()*d.length);
                    cj.innerHTML=d[n];
                },100)
                cj.style.color='';
            }
            js.onclick=function(){
                clearInterval(s);
                cj.style.color='red';
            }
        </script>
    </body>
</html>